﻿<%@ Page Title="" Language="VB" MasterPageFile="~/AMLO/MasterPageAMLO.master" AutoEventWireup="false"
    CodeFile="Amlo1_02_CBS.aspx.vb" Inherits="AMLO_Amlo1_02_CBS" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
            $("input[id$=txtDateStart]").datepicker($.extend({}, $.datepicker.regional['th'], {
                yearAddToDisplay: 543,
                dateFormat: 'dd/mm/yy',
                showOn: "button",
                buttonImage: "../img/calendar.gif",
                buttonImageOnly: true
            }));

            $("input[id$=txtDateEnd]").datepicker($.extend({}, $.datepicker.regional['th'], {
                yearAddToDisplay: 543,
                dateFormat: 'dd/mm/yy',
                showOn: "button",
                buttonImage: "../img/calendar.gif",
                buttonImageOnly: true
            }));

            function EndRequestHandler(sender, args) {
                $("input[id$=txtDateStart]").datepicker($.extend({}, $.datepicker.regional['th'], {
                    yearAddToDisplay: 543,
                    dateFormat: 'dd/mm/yy',
                    showOn: "button",
                    buttonImage: "../img/calendar.gif",
                    buttonImageOnly: true
                }));

                $("input[id$=txtDateEnd]").datepicker($.extend({}, $.datepicker.regional['th'], {
                    yearAddToDisplay: 543,
                    dateFormat: 'dd/mm/yy',
                    showOn: "button",
                    buttonImage: "../img/calendar.gif",
                    buttonImageOnly: true
                }));

            }

        });

        var hasSubmitted = 0;
        function NoDoubleSubmit() {
            var divMsg = document.getElementById('Processing');
            if (hasSubmitted == 0) {
                hasSubmitted = 0;
                divMsg.style.display = 'block';
                return true;
            }
            return false;
        }

        var prm = Sys.WebForms.PageRequestManager.getInstance();

        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);

        function InitializeRequest(sender, args) {
            $get('ContentPlaceHolder1_UpdatePanel1').style.cursor = 'wait';
        }

        function EndRequest(sender, args) {
            $get('ContentPlaceHolder1_UpdatePanel1').style.cursor = 'auto';
        }

        function CheckAll(Checkbox) {
            var GridVwHeaderChckbox = document.getElementById("<%=grdAmlo.ClientID %>");
            for (i = 1; i < GridVwHeaderChckbox.rows.length; i++) {
                GridVwHeaderChckbox.rows[i].cells[15].getElementsByTagName("INPUT")[0].checked = Checkbox.checked;
            }
        }
    </script>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table style="width: 100%;">
                <tr>
                    <td align="right" valign="top" style="width: 100px">
                        <asp:Label ID="lblDept" runat="server" CssClass="control">ฝ่าย</asp:Label>
                    </td>
                    <td align="left" valign="top" style="width: 282px">
                        <asp:DropDownList ID="ddlDepartment" runat="server" AutoPostBack="True" 
                            CssClass="control" Width="196px">
                        </asp:DropDownList>
                    </td>
                    <td align="right" valign="top">
                        <asp:Label ID="lblBranch" runat="server">ส่วนงานสาขา</asp:Label>
                    </td>
                    <td align="left" valign="top">
                        <asp:DropDownList ID="ddlBranch" runat="server" CssClass="control" Width="200px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top">
                        <asp:Label ID="lbltransactionDate" runat="server">วันที่ทำธุรกรรม</asp:Label>
                    </td>
                    <td align="left" valign="top">
                        <asp:TextBox ID="txtDateStart" runat="server" CssClass="control" Height="20px" Width="160px"
                            AutoCompleteType="Disabled"></asp:TextBox>
                    </td>
                    <td align="right" valign="top">
                        ถึง
                    </td>
                    <td align="left" valign="top">
                        <asp:TextBox ID="txtDateEnd" runat="server" CssClass="control" Height="20px" Width="160px"
                            AutoCompleteType="Disabled"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top">
                        <asp:Label ID="lblReportFlg" runat="server">สถานะรายงาน</asp:Label>
                    </td>
                    <td align="left" valign="top" colspan="4">
                        <asp:RadioButtonList ID="rdoReportStatus" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Text="ทั้งหมด" Value="-" />
                            <asp:ListItem Text="ยังไม่ตรวจสอบ" Value="" />
                            <asp:ListItem Text="รายงาน" Value="Y" />
                            <asp:ListItem Text="ไม่รายงาน" Value="N" />
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: right">
                        <asp:Button ID="btnSearch" runat="server" CssClass="control" Text="ค้นหา" Width="80px" />
                        <asp:Button ID="btnPrint" runat="server" CssClass="control" Text="ออกรายงาน" Width="100px" />
                        <asp:Button ID="btnPrintCBS" runat="server" CssClass="control" Text="ออกรายงานธุรกรรมที่เกิดขึ้นจริง" Width="200px" Visible="false" />
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center"> 
                        <span id="Processing" style="display: none">
                            <img src="../img/icon/ajax-loader.gif" alt="Please wait" />
                            กรุณารอสักครู่ ระบบกำลังค้นหาข้อมูล... </span>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center">
                        <asp:Label ID="lblMsg" runat="server" CssClass="control" Font-Bold="True" Font-Size="XX-Large"
                            ForeColor="Red" Height="35px" Text="ไม่พบข้อมูล" Visible="False" Width="170px"></asp:Label>
                     </td>
                </tr>
                <tr>
                    <td colspan="6">
                    </td>
                </tr>
            </table>
                    <asp:Panel ID="pnGridView" runat="server" Width="1200px" ScrollBars="Auto">
                        <asp:GridView ID="grdAmlo" runat="server" AutoGenerateColumns="False" CellPadding="4"
                            ForeColor="#333333" Style="margin-right: 0px; margin-bottom: 0px;" Width="2000px"
                            AllowPaging="True">
                            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                            <Columns>
                                <asp:TemplateField ItemStyle-Width="60px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="btnOpenPopup" runat="server" ImageUrl="~/img/icon/select_icon.gif" 
                                            Visible='<%# iif( IsDBNull(eval("cbs_seq")), False, True) %>'
                                            OnClick="btnMapping_Click" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="รหัสสาขา / วันที่ทำธุรกรรม">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCbsSolId" runat="server" Text='<%# eval("cbs_branchcode") %>' />
                                        <br />
                                        <asp:Label ID="lblCbsTranDate" runat="server" Text='<%# eval("cbs_transdate",  "{0:dd/MM/yyyy}") %>' />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="60px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="เลขที่บัญชี/ชื่อ" ItemStyle-Width="200px">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCBS_ACCOUNTNO" runat="server" Text='<%# eval("CBS_ACCOUNTNO") %>'></asp:Label>
                                        <br />
                                        <asp:Label ID="lblCBS_CUST_NAME" runat="server" Text='<%# eval("CBS_FIRSTNAME") & " " & eval("CBS_LASTNAME") %>'></asp:Label>
                                        <asp:HiddenField ID="hdfCbsSeq" runat="server" Value='<%# eval("cbs_seq") %>' />
                                        <asp:HiddenField ID="hdfCbsSolId" runat="server" Value='' />
                                        <asp:HiddenField ID="hdfCbsTranDate" runat="server" Value='<%# eval("cbs_transdate") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="เลขที่หลักประกัน" DataField="CBS_COL_ID">
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="ไปกรมที่ดิน" DataField="LRO_FLG">
                                    <ItemStyle HorizontalAlign="Center" Width="60px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="วัตถุประสงค์" DataField="CBS_OBJECTIVE">
                                    <ItemStyle HorizontalAlign="Left" Width="200px" />
                                </asp:BoundField>
                                <asp:BoundField DataField="CBS_TRANSAMT" HeaderText="จำนวนเงิน" DataFormatString="{0:N2}">
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="เลขที่รายงาน / ผู้ตรวจสอบ">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCbsFullRptNo" runat="server" Text='<%# eval("CBS_FULL_RPTNO") %>' />
                                        <br />
                                        <asp:Label ID="lblCbsMapBy" runat="server" Text='<%# eval("CBS_MAPBY") %>' />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" Width="150px" />
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate></ItemTemplate>
                                    <HeaderStyle BackColor="Black" Width=" 5px" BorderColor="Black" />
                                    <ItemStyle BackColor="Black" Width="5px" BorderColor="Black" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="รหัสสาขา / วันที่ทำธุรกรรม">
                                    <ItemTemplate>
                                        <asp:Label ID="lblSolId" runat="server" Text='<%# eval("branchcode") %>' />
                                        <br />
                                        <asp:Label ID="lblTranDate" runat="server" Text='<%# eval("transDate",  "{0:dd/MM/yyyy}") %>' />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="VER/SEND">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# eval("RPTREV") %>'></asp:Label>
                                        <asp:Label ID="Label7" runat="server" Text="/"></asp:Label>
                                        <asp:Label ID="Label8" runat="server" Text='<%# iif(eval("ISSEND").ToString ="1" ,"Y", " ") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="RPTNO" HeaderText="เลขที่">
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="เลขที่บัญชี/ชื่อ">
                                    <ItemTemplate>
                                        <asp:Label ID="lblAccountNo" runat="server" Text='<%# Eval("accountno") %>' />
                                        <br />
                                        <asp:Label ID="Label1" runat="server" Text='<%# eval("FirstName") & " " & eval("LastName") %>'></asp:Label>
                                        <asp:HiddenField ID="hdfRptSeq" runat="server" Value='<%# eval("rptseq") %>' />
                                        <asp:HiddenField ID="hdfRptFullNo" runat="server" Value="" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ชนิดธุรกรรม">
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# eval("TRANSTYPENAME") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" Width="130px" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="TRANSAMT" HeaderText="จำนวนเงิน" DataFormatString="{0:N2}">
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="ผู้บันทึก">
                                    <ItemTemplate>
                                        <asp:Label ID="Label5" runat="server" Text='<%# eval("BranchCode") & "  " & eval("UpdateBy") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ลบ/อนุมัติ">
                                    <ItemTemplate>
                                        <asp:Label ID="Label9" runat="server" Text=" "></asp:Label>
                                        <asp:Label ID="Label10" runat="server" Text=" "></asp:Label>
                                        <asp:Label ID="Label11" runat="server" Text='<%# iif(eval("isDelete").ToString ="1", "Y"," ") %>'></asp:Label>
                                        <asp:Label ID="Label6" runat="server" Text="/"></asp:Label>
                                        <asp:Label ID="Label12" runat="server" Text='<%# iif(eval("isConfirm").ToString ="1", "Y"," ") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                </asp:TemplateField>
                            </Columns>
                            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" CssClass="cssPager" />
                            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                            <HeaderStyle BackColor="#FF9933" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                        <table style="width: 2000px;">
                            <tr>
                                <td align="left">
                                    <asp:Label ID="lblTotalCbs" runat="server" Font-Bold="True" ForeColor="#003300"></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:Label ID="lblTotal" runat="server" Font-Bold="True" ForeColor="#003300"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
